🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / feature / settings / src / commonMain / kotlin / org / meshtastic / feature / settings / component / PrivacySection.kt
Displaying Raw • Download
feature/settings/src/commonMain/kotlin/org/meshtastic/feature/settings/component/PrivacySection.kt f4506450168d047b225b277620bf0f1d5dcd13b5 (f4506450) Text, 3.47 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.feature.settings.component
Tff7b72import T7ee787androidx.compose.foundation.layout.ColumnScope
Tff7b72import T7ee787androidx.compose.runtime.Composable
Tff7b72import T7ee787androidx.compose.runtime.LaunchedEffect
Tff7b72import T7ee787org.jetbrains.compose.resources.stringResource
Tff7b72import T7ee787org.meshtastic.core.resources.Res
Tff7b72import T7ee787org.meshtastic.core.resources.analytics_okay
Tff7b72import T7ee787org.meshtastic.core.resources.location_disabled
Tff7b72import T7ee787org.meshtastic.core.resources.provide_location_to_mesh
Tff7b72import T7ee787org.meshtastic.core.ui.component.SwitchListItem
Tff7b72import T7ee787org.meshtastic.core.ui.icon.BugReport
Tff7b72import T7ee787org.meshtastic.core.ui.icon.LocationOn
Tff7b72import T7ee787org.meshtastic.core.ui.icon.MeshtasticIcons
Tff7b72import T7ee787org.meshtastic.core.ui.util.isGpsDisabled
Tff7b72import T7ee787org.meshtastic.core.ui.util.rememberLocationPermissionState
Tff7b72import T7ee787org.meshtastic.core.ui.util.rememberShowToastResource
T8b949e/** Section managing privacy settings like analytics and location sharing. */
Tf0883e@Composable
Tff7b72internal Tff7b72fun Te6edf3ColumnScopeTb4b4b4.Td2a8ffPrivacySettingsContentTb4b4b4(
Te6edf3analyticsAvailableTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3analyticsEnabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleAnalyticsTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3provideLocationTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleLocationTb4b4b4: Tb4b4b4(Tffa657BooleanTb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3homoglyphEnabledTb4b4b4: Tffa657BooleanTb4b4b4,
Te6edf3onToggleHomoglyphTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3startProvideLocationTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Te6edf3stopProvideLocationTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Tffa657UnitTb4b4b4,
Tb4b4b4) Tb4b4b4{
Tff7b72val Te6edf3showToast Tff7b72= Te6edf3rememberShowToastResourceTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3locationPermission Tff7b72= Te6edf3rememberLocationPermissionStateTb4b4b4(Tb4b4b4)
Tff7b72val Te6edf3isGpsOff Tff7b72= Te6edf3isGpsDisabledTb4b4b4(Tb4b4b4)
T8b949e// Key on the boolean grant rather than the full status so a first denial doesn't immediately re-prompt: request()
T8b949e// covers both the never-asked and re-promptable cases, and is a harmless no-op once permanently denied.
Te6edf3LaunchedEffectTb4b4b4(Te6edf3provideLocationTb4b4b4, Te6edf3locationPermissionTb4b4b4.Te6edf3isGrantedTb4b4b4, Te6edf3isGpsOffTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3provideLocationTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Te6edf3locationPermissionTb4b4b4.Te6edf3isGrantedTb4b4b4) Tb4b4b4{
Tff7b72if Tb4b4b4(Tff7b72!Te6edf3isGpsOffTb4b4b4) Tb4b4b4{
Te6edf3startProvideLocationTb4b4b4(Tb4b4b4)
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3showToastTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3location_disabledTb4b4b4)
Tb4b4b4}
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3locationPermissionTb4b4b4.Te6edf3requestTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4} Tff7b72else Tb4b4b4{
Te6edf3stopProvideLocationTb4b4b4(Tb4b4b4)
Tb4b4b4}
Tb4b4b4}
Tff7b72if Tb4b4b4(Te6edf3analyticsAvailableTb4b4b4) Tb4b4b4{
Te6edf3SwitchListItemTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3analytics_okayTb4b4b4)Tb4b4b4,
Te6edf3checked Tff7b72= Te6edf3analyticsEnabledTb4b4b4,
Te6edf3leadingIcon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3BugReportTb4b4b4,
Te6edf3onClick Tff7b72= Te6edf3onToggleAnalyticsTb4b4b4,
Tb4b4b4)
Tb4b4b4}
Te6edf3SwitchListItemTb4b4b4(
Te6edf3text Tff7b72= Te6edf3stringResourceTb4b4b4(Te6edf3ResTb4b4b4.Te6edf3stringTb4b4b4.Te6edf3provide_location_to_meshTb4b4b4)Tb4b4b4,
Te6edf3leadingIcon Tff7b72= Te6edf3MeshtasticIconsTb4b4b4.Te6edf3LocationOnTb4b4b4,
Te6edf3enabled Tff7b72= Tff7b72!Te6edf3isGpsOffTb4b4b4,
Te6edf3checked Tff7b72= Te6edf3provideLocationTb4b4b4,
Te6edf3onClick Tff7b72= Tb4b4b4{ Te6edf3onToggleLocationTb4b4b4(Tff7b72!Te6edf3provideLocationTb4b4b4) Tb4b4b4}Tb4b4b4,
Tb4b4b4)
Te6edf3HomoglyphSettingTb4b4b4(Te6edf3homoglyphEncodingEnabled Tff7b72= Te6edf3homoglyphEnabledTb4b4b4, Te6edf3onToggle Tff7b72= Te6edf3onToggleHomoglyphTb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.04s